Skip to content

feat(search): add cpu subcommand and wide mode to brev search#289

Merged
theFong merged 6 commits intomainfrom
feat/search-cpu-subcommand
Mar 3, 2026
Merged

feat(search): add cpu subcommand and wide mode to brev search#289
theFong merged 6 commits intomainfrom
feat/search-cpu-subcommand

Conversation

@theFong
Copy link
Member

@theFong theFong commented Feb 24, 2026

Summary

  • Restructure brev search into gpu and cpu subcommands (brev search defaults to GPU for backwards compatibility)
  • Add brev search cpu to find CPU-only instances via ?include_cpu=true API endpoint
  • Add --wide flag to GPU search that shows RAM and ARCH columns
  • Add shared --min-vcpu filter across both modes
  • CPU search has dedicated filters (--min-ram, --arch) and columns (TYPE, PROVIDER, VCPUs, RAM, ARCH, DISK, $/GB/MO, BOOT, FEATURES, $/HR)
  • Piping into brev create works for both GPU and CPU table output (verified end-to-end)

Test plan

  • brev search — defaults to GPU search (backwards compatible)
  • brev search gpu — identical to brev search
  • brev search gpu --wide — adds RAM + ARCH columns
  • brev search cpu — shows CPU-only instances
  • brev search cpu --provider gcp --sort price — filters work
  • brev search cpu --min-ram 64 --min-vcpu 32 — numeric filters work
  • brev search cpu --arch x86 — arch filter works
  • brev search cpu --provider gcp | brev create test — pipe into create works (tested live)
  • go test ./pkg/cmd/gpusearch/ ./pkg/cmd/gpucreate/ — all tests pass

@theFong theFong requested a review from a team as a code owner February 24, 2026 07:18
@theFong
Copy link
Member Author

theFong commented Feb 26, 2026

Right now we are showing a bunch of Azure CPUs, I think this is disabled at the brev-deploy layer. We should wait till done

nvidia-smi and system_profiler can be slow. Wrap getGPUInfo in a
goroutine with a 100ms deadline so it never blocks CLI responsiveness.
Restructure `brev search` into gpu/cpu subcommands:
- `brev search` / `brev search gpu` - GPU instances (default, backwards compatible)
- `brev search gpu --wide` - GPU instances with RAM and ARCH columns
- `brev search cpu` - CPU-only instances via ?include_cpu=true API param

CPU search has dedicated columns (TYPE, PROVIDER, VCPUs, RAM, ARCH, DISK,
$/GB/MO, BOOT, FEATURES, $/HR) and filters (--min-ram, --arch).

Shared filters (--provider, --min-vcpu, --min-disk, --max-boot-time,
--stoppable, --rebootable, --flex-ports, --sort) work across both modes.

Piping into `brev create` works for both GPU and CPU table output.
Move --min-ram and --arch from CPU-dedicated flags to shared flags
so they are available on all search subcommands (gpu, cpu, and parent).
- Fix gofumpt formatting
- Remove unused terminal parameter from displayCPUTable
- Reduce cyclomatic complexity of SortInstances using map-based dispatch
@theFong theFong force-pushed the feat/search-cpu-subcommand branch from 9c5b92a to b3fa7ad Compare March 2, 2026 20:22
theFong added 2 commits March 2, 2026 22:07
Show GPU name (e.g. A100, H100) in brev ls table output and JSON.
Fetch instance types concurrently with workspaces for no added latency.
Correctly classify instances as gpu/cpu based on actual GPU support.
Remove misleading '(gpu)' suffix from instance type display.
Add CPU search examples, filters reference, and common patterns.
Update trigger keywords and descriptions to include CPU instances.
@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

❌ Patch coverage is 11.05769% with 370 lines in your changes missing coverage. Please review.
✅ Project coverage is 12.24%. Comparing base (272bf99) to head (ee6686b).
⚠️ Report is 14 commits behind head on main.

Files with missing lines Patch % Lines
pkg/cmd/gpusearch/gpusearch.go 13.60% 267 Missing and 6 partials ⚠️
pkg/cmd/ls/ls.go 0.00% 67 Missing ⚠️
pkg/analytics/posthog.go 0.00% 13 Missing ⚠️
pkg/store/instancetypes.go 0.00% 11 Missing ⚠️
pkg/cmd/util/util.go 0.00% 5 Missing ⚠️
pkg/cmd/gpucreate/gpucreate.go 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #289      +/-   ##
==========================================
- Coverage   13.10%   12.24%   -0.86%     
==========================================
  Files         112      116       +4     
  Lines       14480    15774    +1294     
==========================================
+ Hits         1898     1932      +34     
- Misses      12349    13605    +1256     
- Partials      233      237       +4     
Flag Coverage Δ
Linux 12.24% <11.05%> (-0.86%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@theFong
Copy link
Member Author

theFong commented Mar 3, 2026

Right now we are showing a bunch of Azure CPUs, I think this is disabled at the brev-deploy layer. We should wait till done

this is solved


// getInstanceTypeAndKind returns the instance type and kind (gpu/cpu)
func getInstanceTypeAndKind(w entity.Workspace) (string, string) {
func getInstanceTypeAndKind(w entity.Workspace, gpuLookup map[string]string) (string, string) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function will return "cpu" in the event of on API failure or if the instance type is unknown

@theFong theFong merged commit 335b923 into main Mar 3, 2026
9 of 11 checks passed
@theFong theFong deleted the feat/search-cpu-subcommand branch March 3, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants